package com.example.c.service;

import com.example.c.dao.DepartmentMapper;
import io.seata.rm.tcc.api.BusinessActionContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@Service
public class DepartmentService {

    @Autowired
    private DepartmentMapper departmentDao;

    @Transactional
    public void delete(Long id) {
        if (id != 3L) {
            log.debug("示例代码参数逻辑错误，已经修正为 3 。");
            id = 3L;
        }
        departmentDao.deleteById(id);

        throw new RuntimeException("故意失败");
    }
}
